<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/interfaces/IBranchAddressAccessDao.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/interfaces/IConnectionAccessDao.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/ConnectionFactory.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/FirePHPCore-0.3.2/lib/FirePHPCore/FirePHP.class.php';
		
	$debug = FirePHP :: getInstance(true);
	$debug -> setEnabled(true);
	
	//Permite eliminar los notices
	error_reporting (E_ALL ^ E_NOTICE);

  class   MySqlBranchAddressAccessDao implements IBranchAddressAccessDao {
  
 	 	/**
		 * Constructor
		 */
	 public function __construct () {}
	 
  
     public function createBranchAddress  ($branchAddress) {
		 $pkStartDate = $branchAddress -> getPkStartDate();
		 $endDate = $branchAddress -> getEndDate();
		 $pkFkRifBranch = $branchAddress -> getPkFkRifBranch();
		$connection = ConnectionFactory::getMySqlConnectionAccessDao();
		$conn=$connection->openConnection();
		
		  $GLOBALS['debug'] -> log($pkStartDate, "fecha inicial------crear branch address");
		 
		 $query = "INSERT INTO BRANCH_ADDRESS (pk_start_date, end_date, pk_fk_rif_branch,pk_fk_id_place)
		           VALUES ('$pkStartDate', '$endDate', '$pkFkRifBranch', " . mysql_insert_id() . ")";
	 
	 $GLOBALS['debug'] -> log($query, "Query");
	 
	    $sentence=mysql_query($query,$conn);
	       if ($sentence){
			    return true;
			   }
		  return false;
	 
	 }
	 

	 

  
  }


?>